import $http    from '@/utils/http';
import $toast   from '@/utils/toast';

/**
 * 个人中心--收货地址
 * @param  {[type]} uid 用户ID
 * @return Promise
 */
export function getAddress(uid)
{
	return $http.post('', { module : 'Personalcenter#shipAddress', uid });
}


/**
 * 个人中心--收货地址-设为默认地址
 * @param  {[type]} uid 用户ID
 * @param  {[type]} id 	地址ID
 * @return Promise
 */
export function defaultAddress( uid, id ,isDefaultAddress )
{
	return $http.post('', { module : 'Personalcenter#isDefaultAddress', uid, id , isDefaultAddress });
}


/**
 * 个人中心--收货地址-删除
 * @param  {[type]} uid 用户ID
 * @param  {[type]} id 	地址ID
 * @return Promise
 */
export function deleteAddress( uid, id )
{
	return $http.post('', { module : 'Personalcenter#delShipAddress', uid, id });
}


/**
 * 个人中心--新增收货地址
 * @param  {[type]} uid      	用户ID
 * @param  {[type]} contacts    联系人
 * @param  {[type]} mobile      手机号
 * @param  {[type]} province_id 省
 * @param  {[type]} city_id 	市
 * @param  {[type]} distrct_id  县
 * @param  {[type]} address 	详细地址
 * @return Promise	id :1，		新增
 */
export function addAddress({ uid, contacts, mobile, province_id, city_id, distrct_id, address, id })
{
	return $http.post('', { module : 'Personalcenter#AddShipAddress', uid, contacts, mobile, province_id, city_id, distrct_id, address, id });
}


/**
 * 个人中心--收货地址-收货地址--省市区地址 
 * @return Promise
 */
export function setAddressforRedis(){
	return $http.post('', {module : 'Personalcenter#setAddressforRedis'});
}


/**
 * 体验页面详情页--用户地址及ID
 * @param  {[type]} uid      	用户ID
 * @return Promise
 */
export function getYuyueUserAddress(uid){
	return $http.post('', {module : 'Goods#getYuyueUserAddress', uid});
}

